// createRouter来创建路由实例，createWebHashHistory代表使用hash模式的路由
import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/views/Layout'
import Home from '@/views/Home'
import playGround from '@/views/Playground'
import CateGory from '@/views/Category'
import Sub from '@/views/Category/Sub'
import Goods from '@/views/Goods'
import Login from '@/views/Login'
import Cart from '@/views/Cart'
import callBack from '@/views/Login/callback'
import Settlement from '@/views/Settlement'
import Pay from '@/views/Pay'
const routes = [
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '/',
        component: Home
      },
      {
        path: '/category/:id',
        component: CateGory
      },
      {
        path: '/category/sub/:id',
        component: Sub
      },
      {
        path: '/goods/:id',
        component: Goods
      },
      {
        path: '/cart',
        component: Cart
      },
      {
        path: '/settlement',
        component: Settlement
      },
      {
        path: '/pay',
        component: Pay
      }
    ]
  },
  {
    path: '/play',
    component: playGround
  },
  {
    path: '/login/callback',
    component: callBack
  },
  {
    path: '/login',
    component: Login
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
